<?php

namespace App\Observers;

use App\Models\AgentInfo;
use App\Models\Order;
use App\Models\Setting as SettingModel;
use App\Service\WxArticleData;
use Encore\Admin\Form;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;

class AgentInfoObserver
{
    public function created(AgentInfo $agentInfo){
        //关联创建新代理信息记录
        DB::table('agent_infos')->insert([
            'admin_user_id' => $agentInfo->id,
        ]);

        //绑定代理角色
        DB::table('admin_role_users')->insert([
            'role_id' => 3,
            'user_id' => $agentInfo->id
        ]);

    }

//    public function
}
